﻿<?php
 

abstract class DataMapperAbstract extends GenericArray
{
    public function __construct(MySQLAdapter $db)
    {
        $this->_db = $db;   
    }
	
	// perform query
    public function query($query)
    {
		$this->_db->query($query);
	}
	
	// fetch row from result set
    public function fetch()
    {
		return $this->_db->fetch();
	}
	
	// get insertion ID
    public function getInsertID()
    {
	return $this->_db->getInsertID();
	}
	
	// count rows in result set
    public function countRows()
    {
		return $this->_db->countRows();
	}
	
    // get domain object by ID (implemented by concrete domain object subclasses)
    abstract public function find($id);
	
    // insert domain object (implemented by concrete domain object subclasses)
    abstract public function save(GenericArray $domainObject);
	
    // update domain object (implemented by concrete domain object subclasses)
    abstract public function update(GenericArray $domainObject);
   
    // delete domain object (implemented by concrete domain object subclasses)
    abstract public function delete(GenericArray $domainObject);
}
